package com.mew.common.dc.redis;

import com.mew.common.config.RedisConstantValue;
import com.mew.common.entity.user.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @Author K.Song
 * @Date 2020/11/6 0006
 **/
@Service
@Slf4j
public class UserProfileRedisService {
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;


    public User getRedisUserById(long userId){
        if (userId < 1){
            return null;
        }
        return (User) redisTemplate.opsForHash().get(RedisConstantValue.USER_INFO, userId);
    }


}
